package com.lzzy.net.mapper;

import com.lzzy.net.domain.Comment;
import org.apache.ibatis.annotations.*;

//加上Mapper注解
@Mapper // 表示该类是一个mybatis接口文件，是需要被springboot进行扫描的
public interface CommentMapper {
    //1.先写一个查询方法
    @Select("SELECT * FROM t_comment WHERE id =#{id}")
    public Comment findById(Integer id);

    //2.添加方法
    @Insert("insert into t_comment values(#{id},#{content},#{author},#{aId)")
    public void insertComment(Comment comment);
    //@Insert("INSERT INTO t_comment(content,author,a_id) " +
           // "values (#{content},#{author},#{aId})")
    //public int insertComment(Comment comment);

    //修改
    @Update("UPDATE t_comment SET content=#{content} WHERE id=#{id}")
    public void updateComment(Comment comment);
    //@Update("UPDATE t_comment SET content=#{content} WHERE id=#{id}")
    //public int updateComment(Comment comment);

    //删除
    @Delete("DELETE FROM t_comment WHERE id=#{id}")
    public void deleteComment(Integer id);
   //@Delete("DELETE FROM t_comment WHERE id=#{id}")
    //public int deleteComment(Integer id);

}
